#include <REGX51.H>
#include "Delay.h"

#define uchar unsigned char
#define uint unsigned int

sbit WE = P2^7;
sbit DU = P2^6;

//数码管各段的码表
uchar code table2[] = 
{
0x3f, 0x06, 0x5b, 0x4f,
0x66, 0x6d, 0x7d, 0x07,
0x7f, 0x6f, 0x77, 0x7c,
0x39, 0x5e, 0x79, 0x71
}; 

//数码管各位的码表
uchar code table1[]=
{  
0xff,0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f
};

void Nixie(unsigned char Location, LEDNum)
{
//  遍历
//  uchar i;
//	for(i = 0; i < 8; i++)
//		{
//			WE = 1;
//			P0 = table2[i];
//			WE = 0;
//		
//			DU = 1;
//			P0 = table1[i + 1];
//			DU = 0;
//			Delay(300);
//		}
		WE = 1;
		P0 = table1[Location];
		WE = 0;
		
		DU = 1;
	  P0 = table2[LEDNum];
		DU = 0;
		Delay(1000);
}
